package app.sevenc.lib_framework.permission

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity

/**
 * 权限申请代理类
 * 与三方权限申请框架解耦,方便后续切换三方库
 *
 * @author Seven-C
 * @date 2021/8/5
 */
object PermissionProxy {

    private val permissionImpl: IPermission by lazy { GuolindevPermissionImpl() }

    fun requestPermission(
        activity: FragmentActivity,
        permissions: List<String>,
        action: (Boolean) -> Unit
    ) =
        permissionImpl.activityPermissions(activity, permissions, action)

    fun requestPermission(
        fragment: Fragment,
        permissions: List<String>,
        action: (Boolean) -> Unit
    ) =
        permissionImpl.fragmentPermissions(fragment, permissions, action)

}